
"""
load_all(yaml文件对象) ： 将yaml格式的数据转化为Python对象,支持文件中有多个yaml文档
"""

import yaml

def read_yaml(filename):
    with open(filename,encoding='utf-8') as f:
        python_obj = yaml.load_all(f,Loader=yaml.SafeLoader)
        print("数据类型:{}".format(type(python_obj)))
        for x in python_obj:
            print("x::::",x)


if __name__ == '__main__':
    read_yaml('demo1.yml')